var more = document.querySelectorAll("#homeelec .more ul li");
var page = document.querySelectorAll("#homeelec .page-main-right .ve");
for (var i = 0 ; i < more.length ; i++){
    more[i].onclick = qwe;
}
function qwe(){
    for (var i = 0 ; i< more.length ; i++){
        if(more[i] === this){
            more[i].className = "tab-active";
            page[i].className = "acti ve"
        }else {
            more[i].className = "";
            page[i].className = "ve"
        }
    }
}

var smart = document.querySelectorAll("#smart .more ul li");
var mina = document.querySelectorAll("#smart .page-main-right .ve");
for (var i = 0 ; i < smart.length ; i++){
    smart[i].onclick = qwer;
}
function qwer(){
    for (var i = 0 ; i< smart.length ; i++){
        if(smart[i] === this){
            smart[i].className = "tab-active";
            mina[i].className = "acti ve"
        }else {
            smart[i].className = "";
            mina[i].className = "ve"
        }
    }
}


/*视频播放*/
var uli = document.querySelectorAll(".box-bd ul li.video-item .figure > span");
var shipin = document.querySelectorAll(".shipin .modal");
var guanbi = document.querySelectorAll(".shipin .modal .modal-hd i");
var bofang = document.querySelectorAll(".shipin .modal .jp-video-play i");
var bofangimg = document.querySelectorAll(".shipin .modal .jp-video .jp-jplayer > img");
var bag = document.querySelector(".bag");
for(var j = 0 ; j < uli.length ;j++){
    uli[j].onclick = fuene;
    guanbi[j].onclick = fuene;
    bofang[j].onclick = fuene;
}
function fuene(){
    for(var j = 0 ; j < uli.length ;j++){
        if(uli[j] === this){
            bag.style.display = "block";
            shipin[j].style.display = "block";
        }
    }
    for(var l = 0 ; l < guanbi.length ;l++){
        if(guanbi[l] === this){
            shipin[l].style.display = "none";
            bag.style.display = "none";
        }
    }
    for(var k = 0 ; k < bofang.length ;k++){
        if(bofang[k] === this){
            bofangimg[k].style.display = "none";
            bofang[k].style.display = "none";

        }
    }
}
/*手机APP*/

var bar = document.querySelector(".bar-sort-qr a");
var bar_pop = document.querySelector(".bar-pop");


bar.addEventListener("mousemove",function(){
    bar_pop.style.display = "block";
});
bar.addEventListener("mouseout",function(){
    bar_pop.style.display = "none";
});


bar_pop.addEventListener("mousemove",function(){
    bar_pop.style.display = "block";
});
bar_pop.addEventListener("mouseout",function(){
    bar_pop.style.display = "none";
});

/*左右切换*/
var swiper = document.querySelector(".swiper-container");
var prev = document.querySelector(".swiper-button-prev");
var next = document.querySelector(".swiper-button-next");
swiper.addEventListener("mouseover",function(){
    prev.style.display = "block";
    next.style.display = "block";
});
swiper.addEventListener("mouseout",function(){
    prev.style.display = "none";
    next.style.display = "none";
});

/*返回顶部*/
var fd = document.querySelector(".show");
window.onscroll = function(){
    if(document.documentElement.scrollTop > 1000 || document.body.scrollTop > 1000){
        fd.style.display = "block";
    }else if(document.documentElement.scrollTop == 0 || document.body.scrollTop == 0){
        fd.style.display = "none";
    }
};


fd.addEventListener("click",function(){
    window.scrollTo({
        top:0,
        behavior:'smooth'
    });
});










